from flask import Flask, request, Response
import json

app = Flask(__name__)

@app.route('/')
def hello_world():
    return "Hello World!"

@app.route('/add', methods=['POST'])
def add():
    print(request.headers)
    print(type(request.json))
    print(request.json)
    result = {'sum': request.json['a'] + request.json['b'] }
    resp = Response(json.dumps(result), mimetype='application/json')
    resp.headers.add('Server', 'python_flask')
    return resp

if __name__ == '__main__':
    app.run(port=5000, debug=True)